home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Communications / General / LineShare Folder / Put Onto Productions Disks / ARA⁄LineShare / ARA_LineShare next >
Text File  |  1994-04-22  |  5KB  |  256 lines

  1. ! Version 2.5
  2. ! ARA 2.0 script for connections through a LineShare subPort.
  3. ! All modem-specific commands should be moved to the LineShare script.
  4. ! So, this ARA script is universal
  5. !
  6. ! We assume that the LineShare script has set the modem to the
  7. !   "Direct" mode, if the "CONNECT" message is detected
  8. !    (in this case our business is to adjust the serial port speed), or to the
  9. !   "Normal" mode, if the "CARRIER" message is detected.
  10. ! If LineShare returns the REL message,
  11. !   we tell ARA 2.0, that a reliable link is established
  12. ! We don't process the "^2" parameter (speaker), since it's controlled with LineShare
  13. !
  14. !
  15. @ORIGINATE
  16. @ANSWER
  17.   HSReset 0 0 0 0 0 0
  18. !
  19. ! Load Factory configurations (i.e. reset the LineShare emulator),switch off the echo
  20. !
  21.   matchclr
  22.   matchstr 1 1 "OK\13\10"
  23.   write "AT&FE0\13"
  24.   matchread 10
  25.   jump 79
  26. @LABEL 1
  27. !
  28. ! The modem is ready so enable answering, or originate a call
  29. !
  30.   ifAnswer 10
  31. !
  32. ! 0,1,2 - Normal,Blind,Manual
  33.   ifStr 6 7 "0"
  34.   ifStr 6 5 "1"
  35.   ifStr 6 4 "2"
  36.   Jump 8
  37. !
  38. @LABEL 4
  39.   Note "Manual dialing initiated..." 3
  40.   Write "ATX1D \13"
  41.   Jump 15
  42. !
  43. @LABEL 5
  44.   note "Dialing without dialtone." 3
  45.   MatchClr
  46.   MatchStr 1 7 "OK\13\10"
  47.   Write "ATX3\13"
  48.   MatchRead 30
  49.   jump 79
  50. !
  51. ! Parameter 1 contains the full dialstring from the connection document.
  52. ! Parameter 3 contains "P" for pulse & "t" for tone dialing.
  53. ! Parameter 7, 8 & 9 contain the dial string fragments (only parameter 7 is used)
  54. @Label 7
  55.   Note "Dialing ^7." 3
  56.   Write "ATD^3^7\13"
  57.   Jump 15
  58. @Label 8
  59.   Note "Dialing ^1." 3
  60.   Write "ATDT^1\13"
  61.   Jump 15
  62. !
  63. !
  64. ! Answering
  65. @LABEL 10
  66.   MatchClr
  67.   MatchStr 1 15 "OK\13\10"
  68.   Write "ATS0=1\13"
  69.   MatchRead 30
  70.   Jump 79
  71. !
  72. @LABEL 15
  73.   MatchClr
  74.   MatchStr 1 19 "CARRIER "
  75.   Matchstr 2 18 "CONNECT "
  76.   matchstr 8 16 "RING\13\10"
  77.   matchstr 9 17 "REL\13\10"
  78.   matchstr 10 70 "NO CARRIER\13\10"
  79.   matchstr 11 70 "ERROR\13\10"
  80.   matchstr 12 72 "NO DIALTONE\13\10"
  81.   matchstr 13 73 "BUSY\13\10"
  82.   matchstr 14 74 "NO ANSWER\13\10"
  83.   matchread 800
  84.   ifAnswer 10
  85.   Jump 79
  86. !
  87. @LABEL 16
  88.   ifOriginate 15
  89.   userhook 1
  90.   note "Answering phone…" 2
  91.   Jump 15
  92. !
  93. @LABEL 17
  94.   userhook 2
  95.   note "Reliable link…" 3
  96.   jump 15
  97. !
  98. ! Process the "CONNECT" message - assume that we are in the "Direct" mode
  99. @LABEL 18
  100.   MatchClr
  101.   matchstr 2 22 "2400"
  102.   matchstr 3 23 "4800"
  103.   matchstr 4 24 "7200"
  104.   matchstr 5 25 "9600"
  105.   matchstr 6 26 "12000"
  106.   matchstr 7 27 "14400"
  107.   matchstr 8 28 "16800"
  108.   matchstr 9 29 "19200"
  109.   matchread 10
  110.   jump 79
  111.  
  112. !
  113. ! Process the "CARRIER" message - assume that we are in the "Normal" mode
  114. @LABEL 19
  115.   MatchClr
  116.   matchstr 2 32 "2400"
  117.   matchstr 3 33 "4800"
  118.   matchstr 4 34 "7200"
  119.   matchstr 5 35 "9600"
  120.   matchstr 6 36 "12000"
  121.   matchstr 7 37 "14400"
  122.   matchstr 8 38 "16800"
  123.   matchstr 9 39 "19200"
  124.   matchread 10
  125.   jump 79
  126.  
  127. @LABEL 22
  128.   note "Communicating at 2400 bps." 2
  129.   setspeed 2400
  130.   jump 61
  131. !
  132. @LABEL 23
  133.   note "Communicating at 4800 bps." 2
  134.   setspeed 4800
  135.   jump 61
  136. !
  137. @LABEL 24
  138.   note "Communicating at 7200 bps." 2
  139.   setspeed 7200
  140.   jump 61
  141. !
  142. @LABEL 25
  143.   note "Communicating at 9600 bps." 2
  144.   setspeed 9600
  145.   jump 61
  146. !
  147. @LABEL 26
  148.   note "Communicating at 12000 bps." 2
  149.   setspeed 12000
  150.   jump 61
  151. !
  152. @LABEL 27
  153.   note "Communicating at 14400 bps." 2
  154.   setspeed 14400
  155.   jump 61
  156. !
  157. @LABEL 28
  158.   note "Communicating at 16800 bps." 2
  159.   setspeed 16800
  160.   jump 61
  161. !
  162. @LABEL 29
  163.   note "Communicating at 19200 bps." 2
  164.   setspeed 19200
  165.   jump 61
  166. !
  167. ! CARRIER XXXX processing
  168. !
  169. @LABEL 32
  170.   note "Linked at 2400 bps." 2
  171.   CommunicatingAT 2400
  172.   jump 60
  173. !
  174. @LABEL 33
  175.   Note "Linked at 4800 bps." 2
  176.   CommunicatingAT 4800
  177.   jump 60
  178. !
  179. @LABEL 34
  180.   note "Linked at 7200 bps." 2
  181.   CommunicatingAT 7200
  182.   jump 60
  183. !
  184. @LABEL 35
  185.   note "Linked at 9600 bps." 2
  186.   CommunicatingAT 9600
  187.   jump 60
  188. !
  189. @LABEL 36
  190.   note "Linked at 12000 bps." 2
  191.   CommunicatingAT 12000
  192.   jump 60
  193. !
  194. @LABEL 37
  195.   note "Linked at 14400 bps." 2
  196.   CommunicatingAT 14400
  197.   jump 60
  198. !
  199. @LABEL 38
  200.   note "Linked at 16800 bps." 2
  201.   CommunicatingAT 16800
  202.   jump 60
  203. !
  204. @LABEL 39
  205.   note "Linked at 19200 bps." 2
  206.   CommunicatingAT 19200
  207.   jump 60
  208. !
  209. @LABEL 60
  210.   HSReset 0 1 0 0 0 0
  211. @LABEL 61
  212.   ifANSWER 62
  213.   pause 30
  214. @LABEL 62
  215.   exit 0
  216. !
  217. !
  218. ! 70: error messages
  219. ! No carrier
  220. @LABEL 70
  221.   exit -6021
  222. ! No Dial Tone
  223. @LABEL 72
  224.   exit -6020
  225. ! Busy
  226. @LABEL 73
  227.   exit -6022
  228. ! No Answer
  229. @LABEL 74
  230.   exit -6023
  231. ! Invalid Varstring Value
  232. @LABEL 76
  233. exit -6027
  234. ! Modem error
  235. @LABEL 79
  236.   exit -6019
  237. !
  238. ! Hang up the modem
  239. !
  240. @HANGUP
  241.   HSReset 0 0 0 0 0 0
  242.   settries 0
  243. @LABEL 80
  244.   DTRClear
  245.   pause 2
  246.   DTRSet
  247.   write "ATZ\13"
  248.   matchclr
  249.   matchstr 1 82 "OK\13\10"
  250.   matchread 30
  251.   inctries
  252.   iftries 3 82
  253.   jump 80
  254. !
  255. @LABEL 82
  256.   exit 0